Skip to main content

Key Generation

As part of the encryption process you will need to generate both public and private keys, for encryption and decryption purposes. You will keep the private key and share the public key with the VodaPay team

note

In the sandbox environment the VodaPay team will generate both for you. You will, however, need to generate your own keys in production

Key generation

  • Open the Git Bash, or linux based shell e.g. wsl etc, shell

  • To Create RSA 2048 Keys run the following Commands

    openssl genrsa -out rsa_2048_key.pem 2048
  • To export Public Key

    openssl rsa -in rsa_2048_key.pem -out rsa_public_key.pem -pubout
  • To Export Private Key with PKCS#8 Encode

    openssl pkcs8 -topk8 -in rsa_2048_key.pem -out rsa_private_key.pem -nocrypt
caution

For security reason it is highly recommended that you keep your private key safe. It should not reside in the root of your app or any othe unsecured location.

tip

This snippet should run all three steps

openssl genrsa -out rsa_2048_key.pem 2048; openssl rsa -in rsa_2048_key.pem -out rsa_public_key.pem -pubout; openssl pkcs8 -topk8 -in rsa_2048_key.pem -out rsa_private_key.pem -nocrypt
  • Send us the rsa_public_key.pem file.

Snippets

How to generate keys

Private Key

Public key